import { request } from 'umi';

import {
  AreaListParamsType,
  DeleteDoorType,
  DoorListParamsType,
  PlanModeParamsType,
  AddDoorType,
  AddDoorToDoorGroupType,
  AddDoorGroupType,
  EditDoorGroupType,
  SentDownPlanModeType,
  DoorInfoType,
} from './API';
//
export async function queryDoorGroupListAPI(params?: DoorListParamsType) {
  return request<API.APIReturnType<any>>('/api/doorGroup/list', { params: params || {} });
}
export async function queryAreaListAPI(params?: AreaListParamsType) {
  return request<API.APIReturnType<any>>('/api/area/listArea', { params: params || {} });
}
export async function queryDoorListFormDoorGroupIdAPI(params?: DoorListParamsType) {
  return request<API.APIReturnType<any>>('/api/doorGroup/doorList', { params: params || {} });
}

export async function queryDoorListAPI(params?: DoorListParamsType) {
  return request<API.APIReturnType<any>>('/api/door/list', { params: params || {} });
}
export async function queryPlanModeAPI(params?: PlanModeParamsType) {
  return request<API.APIReturnType<any>>('/api/planMode/list', { params: params || {} });
}
export async function queryControllerTypeAPI() {
  return request<API.APIReturnType<any>>('/api/door/controllerType');
}
export async function queryDoorOpenTypeAPI() {
  return request<API.APIReturnType<any>>('/api/door/openType');
}
export async function addDoorGroupAPI(params?: AddDoorGroupType) {
  return request<API.APIReturnType<any>>('/api/doorGroup/add', {
    method: 'post',
    data: params || {},
  });
}
export async function deleteDoorGroupAPI(params?: { id: number }) {
  return request<API.APIReturnType<any>>('/api/doorGroup/delete', {
    method: 'post',
    data: params || {},
  });
}
export async function addDoorToDoorGroupAPI(params?: AddDoorToDoorGroupType) {
  return request<API.APIReturnType<any>>('/api/doorGroup/editGroup', {
    method: 'post',
    data: params || {},
  });
}
export async function editDoorGroupAPI(params?: EditDoorGroupType) {
  return request<API.APIReturnType<any>>('/api/doorGroup/edit', {
    method: 'post',
    data: params || {},
  });
}
export async function addDoorAPI(params?: AddDoorType) {
  return request<API.APIReturnType<any>>('/api/door/add', { method: 'post', data: params || {} });
}
export async function sentDownPlanModeAPI(params?: SentDownPlanModeType) {
  return request<API.APIReturnType<any>>('/api/door/sentDownPlanMode', {
    method: 'post',
    data: params || {},
  });
}
export async function deleteDoorAPI(params?: DeleteDoorType) {
  return request<API.APIReturnType<any>>('/api/door/delete', {
    method: 'post',
    data: params || {},
  });
}
export async function editDoorAPI(params?: AddDoorType) {
  return request<API.APIReturnType<any>>('/api/door/edit', { method: 'post', data: params || {} });
}
export async function queryDoorInfoAPI(params?: DoorInfoType) {
  return request<API.APIReturnType<any>>('/api/door/info', { params: params || {} });
}
